import type { AxiosResponseType } from '@/types/http'
import { requestAPINoLoading } from '@/utils/http/request'

/**
 * 仪表盘服务器数据统计
 * @returns
 */
export const getServerStatus = (days: number) => {
  const url = `/admin-api/business/stats/summary?days=${days}`
  return requestAPINoLoading.get<
    AxiosResponseType<{
      time: string
      netName: string
      total: number
      realNum: number
      serverNum: number
      taskNum: number
      platformNum: number
      realStats: {
        ip: string
        name: string
        value: string
      }[]
      dateStats: {
        date: string[]
        count: string[]
      }
    }>
  >(url)
}
/**
 * 任务状态分布
 */
export const getTaskStatus = () => {
  const url = `/admin-api/business/stats/task/stats`
  return requestAPINoLoading.get<AxiosResponseType<{ name: string; value: number }[]>>(url)
}
